<%@ tag import="org.internna.iwebmvc.spring.jee.IWebMvcCombinedFilter" %>
<%@ tag description="Allows creation of a IWebJTracker project" pageEncoding="UTF-8" %>
<%@ taglib prefix="iwebmvc" uri="http://tags.iwebmvc.com" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
<%@ attribute name="newprojectid" required="true" %>
<%@ attribute name="projectClass" type="java.lang.Class" required="true" %>
<%@ attribute name="connectionDetailsClass" type="java.lang.Class" required="true" %>
<%@ attribute name="serverManager" type="org.internna.iwebjtracker.server.ServerManager" required="true" %>
<c-rt:set var="sessionUser" value="<%= org.internna.iwebmvc.security.UserManager.SESSION_USER %>" />
<div class="field">
    <iwebmvc:enum entityClass="${projectClass}" path="projectType" id="${newprojectid}" rows="5" helpText="ui.help.newproject.type" onChange="changeNewProjectType('${newprojectid}')" />
</div>
<div class="field">
    <label for="type${newprojectid}" class="label"><iwebmvc:message argMessage="ui.newproject.servertype" /></label>
    <select dojoType="dijit.form.FilteringSelect" id="serverType${newprojectid}" name="type${newprojectid}" onChange="changeNewProjectServerType('${newprojectid}')">
        <option value="">&nbsp;</option>
        <c:forEach items="${serverManager.configuredSCMServers}" var="serverType">
            <option value="${serverType}"><iwebmvc:message argMessage="${serverType}" altText="${serverType}" /></option>
        </c:forEach>
    </select>
</div>
<div id="newProjectServerDetails${newprojectid}" style="display:inline-block">
    <div class="field">
        <iwebmvc:locator entityClass="${projectClass}" path="connectionDetails" id="${newprojectid}" baseColumnWidth="100" pages="5" rows="6" supportsEditionMode="false" required="true" currentDepthLevel="0" nestedCrud="true" />
    </div>
    <div class="field">
        <iwebmvc:textbox entityClass="${projectClass}" path="relativePath" helpText="ui.help.newproject.relativePath" id="${newprojectid}" />
    </div>
</div>
<div id="newProjectFreeFormDetails${newprojectid}" style="display:inline-block">
    <div class="field"><iwebmvc:textbox entityClass="${projectClass}" path="projectName" id="${newprojectid}" /></div>
    <div class="field"><iwebmvc:textbox entityClass="${projectClass}" path="description" id="${newprojectid}" /></div>
    <div class="field"><iwebmvc:textbox entityClass="${projectClass}" path="currentVersion" id="${newprojectid}" /></div>
    <div class="field"><iwebmvc:textbox entityClass="${projectClass}" path="homePage" id="${newprojectid}" /></div>
</div>
<div class="newProjectButtonContainer">
    <span id="validationWarningContainer" class="validationWarning"></span>
    <iwebmvc:button buttonId="check${newprojectid}" label="ui.newproject.button.check" buttonIcon="/resource.iwebmvc?file=/images/common/validate_${sessionScope[sessionUser].theme}.gif">
        dijit.byId("check${newprojectid}").setDisabled(true);
        dojo.byId("validationWarningContainer").innerHTML = "<img src='" + contextPath + "resource.iwebmvc?file=images/loading.gif' alt='' />";
        validateProjectData('${newprojectid}', '${iwebmvc:inferDWRConvertedJavascriptClass(projectClass)}', '${iwebmvc:inferDWRConvertedJavascriptClass(connectionDetailsClass)}');
    </iwebmvc:button>
    <iwebmvc:button buttonId="save${newprojectid}" label="ui.newproject.button.save" buttonIcon="/resource.iwebmvc?file=/images/common/save_${sessionScope[sessionUser].theme}.gif">
        createProject('${newprojectid}', '${iwebmvc:inferDWRConvertedJavascriptClass(projectClass)}', '${iwebmvc:inferDWRConvertedJavascriptClass(connectionDetailsClass)}');
    </iwebmvc:button>
</div>